package com.dh.user.utils;

import com.dh.user.VO.ResultVO;
import com.dh.user.enums.ResultEnum;

/**
 * 
 * @ClassName: ResultVOUtil
 * @Description: TODO
 * @author dinghao
 * @date 2018年11月14日 下午4:24:26
 *
 */
public class ResultVOUtil {
	
	public static ResultVO<Object> success() {
		ResultVO<Object> resultVO = new ResultVO<>();
		resultVO.setCode(0);
		resultVO.setMsg("成功");
		return resultVO;
	}

	public static ResultVO<Object> success(Object object) {
		ResultVO<Object> resultVO = new ResultVO<>();
		resultVO.setCode(0);
		resultVO.setMsg("成功");
		resultVO.setData(object);
		return resultVO;
	}
	
	public static ResultVO<Object> error(ResultEnum resultEnum) {
		ResultVO<Object> resultVO = new ResultVO<>();
		resultVO.setCode(resultEnum.getCode());
		resultVO.setMsg(resultEnum.getMessage());
		return resultVO;
	}
}
